/*
 * @FileName: OrgNode.java
 * 
 * @Author
 * 
 * @Description:
 * 
 * @Date 2016年1月15日 下午4:24:36
 * 
 * @CopyRight ZTE Corporation
 */
package cn.hpclub.server.bean;

import java.util.LinkedList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.hpclub.server.util.OrganizationTree;

/**
 * Class description goes here
 *
 * @author
 */
public class OrgNode{
    private static Logger log      = LoggerFactory.getLogger(OrganizationTree.class);

    String                displayName;
    int                   id;
    int                   parentId = 0;
    List<OrgNode>         subNode;

    public OrgNode(int id, String displayName, int parentId){
        this.id = id;
        this.displayName = displayName;
        this.parentId = parentId;
        subNode = new LinkedList<OrgNode>();
    }

    public void setSubNode(List<OrgNode> subNode){
        this.subNode = subNode;
    }

    public void setDisplayName(String displayName){
        this.displayName = displayName;
    }

    public int getParentId(){
        return parentId;
    }

    public String getDisplayName(){
        return displayName;
    }

    public int getId(){
        return id;
    }

    public List<OrgNode> getSubNode(){
        return subNode;
    }

    public void printNode(String prefix){
        log.debug(prefix + "[" + displayName + ", id:" + id + ", pID:" + parentId + "]");
        if(subNode != null){
            for(OrgNode node : subNode){
                node.printNode(prefix + "---");
            }
        }
    }
}
